<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019-02-21
 * Time: 10:48
 */

namespace app\common\model;


use think\Db;
use think\Model;

class Transferrecordm extends Model
{

    public static function index($map = [], $page)
    {
        return Db::name('transfer_record')
            ->join('user one', 'tr_out_uid = one.u_id', 'left')
            ->join('user two', 'tr_enter_uid = two.u_id', 'left')
            ->join('project', 'tr_pid = p_id', 'left')
            ->where($map)
            ->field('tr_id, one.u_email as oneemail, two.u_email as twoemail, tr_type, p_name, tr_market_value, tr_dollar,
             from_unixtime(tr_create_time) tr_create_time')
            ->order('tr_id DESC')
            ->paginate(15, false, ['page' => $page]);
    }

    /**
     * 提现详情
     */
    public static function detail($id)
    {
        return Db::name('transfer_record')
            ->join('user one', 'tr_out_uid = one.u_id', 'left')
            ->join('user two', 'tr_enter_uid = two.u_id', 'left')
            ->join('project', 'tr_pid = p_id', 'left')
            ->where('tr_id', $id)
            ->field('tr_id, one.u_email as oneemail, two.u_email as twoemail, tr_type, p_name, tr_market_value, tr_dollar,
             from_unixtime(tr_create_time) tr_create_time')
            ->find();
    }
}